/**
 * 菜单+路由配置文件
 * @author songsq
 *
 * @param key @description 菜单唯一标识
 * @param icon @description 图标
 * @param name @description 路由唯一标识
 * @param path 路由地址 @description 子级和父级的路由地址需累加配置，否则目录将不会展开 例：父级目录（/sys）,子级菜单(/sys/user)
 * @param hidden @description 是否可见
 * @param children @description 子路由
 * @param meta.title @description 菜单名称
 * @param meta.icon @description 菜单图标
 * @param permission @description 资源编码
 */
import Layout from "@/layout";
import Home from "@/views/home";
import RouteView from "@/layout/routeView";
// const RouteView = {
//     name: 'RouteView',
//     render: (h) => h('router-view')
// }
import * as icon from "@/config/icon";
/**
 * 动态路由
 */
export const asyncRouterMap = [
    {
        path: "/",
        name: "Layout",
        component: Layout,
        redirect: () => {
            return { path: "/home" };
        },
        // redirect: { name: 'Home' },
        hidden: true,
        children: [
            {
                key: "1",
                path: "/home",
                name: "Home",
                component: Home,
                hidden: true,
                meta: { title: "主页", icon: icon.home, keepAlive: true },
            },
            {
                key: "2-1",
                path: "/personal",
                name: "personal",
                component: () => import("@/views/personal"),
                hidden: false,
                meta: { title: "个人设置", icon: " ", keepAlive: true },
            },
            {
                key: "3",
                path: "/sys",
                name: "Sys",
                component: RouteView,
                redirect: () => {
                    return { path: "/sys/user" };
                },
                hidden: true,
                meta: { title: "系统管理", icon: icon.setting },
                children: [
                    {
                        key: "3-1",
                        path: "/sys/user",
                        name: "SysUser",
                        component: () => import("@/views/sys/sysUser"),
                        hidden: true,
                        meta: {
                            title: "用户管理",
                            icon: " ",
                            permission: "sysUser",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-2",
                        path: "/sys/role",
                        name: "SysRole",
                        component: () => import("@/views/sys/sysRole"),
                        hidden: true,
                        meta: {
                            title: "角色管理",
                            icon: " ",
                            permission: "sysRole",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-3",
                        path: "/sys/permission",
                        name: "SysPermission",
                        component: () => import("@/views/sys/sysPermission"),
                        hidden: true,
                        meta: {
                            title: "资源管理",
                            icon: " ",
                            permission: "sysPermission",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-4",
                        path: "/sys/authority",
                        name: "SysAuthority",
                        component: () => import("@/views/sys/sysAuthority"),
                        hidden: true,
                        meta: {
                            title: "接口权限",
                            icon: " ",
                            permission: "sysAuthority",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-5",
                        path: "/sys/uploadStatic",
                        name: "SysUploadStatic",
                        component: () => import("@/views/sys/uploadStatic"),
                        hidden: true,
                        meta: {
                            title: "上传资源",
                            icon: " ",
                            permission: "uploadStatic",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-6",
                        path: "/sys/statistics",
                        name: "SysStatistics",
                        component: () => import("@/views/sys/statistics"),
                        hidden: true,
                        meta: {
                            title: "数据记录",
                            icon: " ",
                            permission: "statistics",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-7",
                        path: "/sys/visit",
                        name: "SysVisit",
                        component: () => import("@/views/sys/visit"),
                        hidden: true,
                        meta: {
                            title: "访问统计",
                            icon: " ",
                            permission: "visit",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-8",
                        path: "/sys/job",
                        name: "SysJob",
                        component: () => import("@/views/sys/job"),
                        hidden: true,
                        meta: {
                            title: "定时任务",
                            icon: " ",
                            permission: "sys_job",
                            keepAlive: true,
                        },
                    },
                    {
                        key: "3-9",
                        path: "/sys/joblog",
                        name: "SysJobLog",
                        component: () => import("@/views/sys/job/log"),
                        hidden: false,
                        meta: {
                            title: "定时任务日志",
                            icon: " ",
                            permission: "sys_job",
                            keepAlive: true,
                        },
                    },
                ],
            },
            {
                key: "4",
                path: "/client",
                name: "Client",
                component: RouteView,
                redirect: () => {
                    return { path: "/client/sys" };
                },
                hidden: true,
                meta: { title: "客户端", icon: icon.cloud },
                children: [
                    {
                        key: "4-1",
                        path: "/client/sys",
                        name: "ClientSys",
                        redirect: () => {
                            return { path: "/client/sys/user" };
                        },
                        component: RouteView,
                        hidden: true,
                        meta: { title: "系统管理", icon: icon.setting },
                        children: [
                            {
                                key: "4-1-1",
                                path: "/client/sys/user",
                                name: "ClientSysUser",
                                component: () => import("@/views/client/sys/sysUser"),
                                hidden: true,
                                meta: {
                                    title: "用户管理",
                                    icon: " ",
                                    permission: "client_user",
                                    keepAlive: true,
                                },
                            },
                            {
                                key: "4-1-2",
                                path: "/client/sys/role",
                                name: "ClientSysRole",
                                component: () => import("@/views/client/sys/sysRole"),
                                hidden: true,
                                meta: {
                                    title: "角色管理",
                                    icon: " ",
                                    permission: "client_role",
                                    keepAlive: true,
                                },
                            },
                            {
                                key: "4-1-3",
                                path: "/client/sys/permission",
                                name: "ClientSysPermission",
                                component: () => import("@/views/client/sys/sysPermission"),
                                hidden: true,
                                meta: {
                                    title: "资源管理",
                                    icon: " ",
                                    permission: "client_permission",
                                    keepAlive: true,
                                },
                            },
                            {
                                key: "4-1-4",
                                path: "/client/sys/authority",
                                name: "ClientSysAuthority",
                                component: () => import("@/views/client/sys/sysAuthority"),
                                hidden: true,
                                meta: {
                                    title: "接口权限",
                                    icon: " ",
                                    permission: "client_authority",
                                    keepAlive: true,
                                },
                            },
                            {
                                key: "4-1-5",
                                path: "/client/sys/agreement",
                                name: "ClientSysAgreement",
                                component: () => import("@/views/client/sys/sysAgreement"),
                                hidden: true,
                                meta: {
                                    title: "系统协议",
                                    icon: " ",
                                    permission: "client_agreement",
                                    keepAlive: true,
                                },
                            },
                        ],
                    },
                ],
            },
        ],
    },
    {
        path: "*",
        redirect: "/404",
        hidden: true,
    },
];
/**
 * 基础路由
 */
export const constantRouterMap = [
    {
        path: "/404",
        name: "NotFound",
        component: () => import("@/views/constant/404_ant"),
        meta: {
            keepAlive: true,
        },
    },
    {
        path: "/login",
        name: "Login",
        component: () => import("@/views/constant/login"),
    },
];
